<?php 
header("content-type: application/x-javascript");
require_once(dirname(__FILE__).'/inc/class/init.php');
require_once(dirname(__FILE__)."/inc/session_auth.php");
$arrsData = WF::getWidgetPoolFactory()->getWidgetPoolDB()->getArrsDataWidgetList();

$strJSON = 'widgetList = {';
if(is_array($arrsData) && $arrsData){
	$strJSON .= '"widgets": [';
	$arrWidget = array();
	foreach($arrsData as $arrData){
		$arrWidget[] = '{"category": "'.$arrData['category'].'",  "name": "'.$arrData['name'].'",  "modname": "'.$arrData['modname'].'", "icon":"'.$arrData['icon'].'", "icon_preview":"'.$arrData['icon_preview'].'","lastupdate":"'.(($arrData['lastupdate']) ? $arrData['lastupdate'].'000' : "0").'","userGenerated":"'.$arrData['userGenerated'].'","widget_key":"'.$arrData['widget_key'].'","param":"'.addslashes($arrData['param']).'"}';
	}
	$strJSON .= implode(',',$arrWidget);
	$strJSON .= ']';
}
$strJSON .= '};';

echo $strJSON;
/*echo '<br />';
echo '

var widgetList ={ 
        "widgets": [
 			{"category": "WidgetFramework",  "name": "modTodo"         , "icon":"wicon_default.gif","lastupdate":"0"},
			{"category": "WidgetFramework",  "name": "modSearch"       , "icon":"wicon_default.gif","lastupdate":"0"}, 
			{"category": "WidgetFramework",  "name": "modWeather"      , "icon":"wicon_default.gif","lastupdate":"0"}, 
      {"category": "WidgetFramework",  "name": "modFlickr"       , "icon":"wicon_default.gif","lastupdate":"0"},
      {"category": "WidgetFramework",  "name": "modExpandableColumns"         , "icon":"wicon_default.gif","lastupdate":"0"}, 
      {"category": "WidgetFramework",  "name": "mod2Div"         , "icon":"wicon_default.gif","lastupdate":"0"}
     
     
        ]	
	};';*/
